<?php defined('SYSPATH') OR die('No direct access allowed.');

abstract class MyTemplate_Controller extends Template_Controller {

    public $template = 'templates/template';
    protected $matriculaUser = true;
    protected $validacao;

    function __construct() {
        parent::__construct();
        $this->validacao = new Login_Model();
        $this->template->titulo = 'Biblioteca Online';
        $this->template->header = 'Biblioteca Online';
        $this->verificaPermissao();
    }

    private function verificaPermissao () {
        if ( !$this->validacao->verificarUsuarioLogado() ) {
            $this->matriculaUser = false;
            $this->exibirTelaLogin();
        }
    }

    protected function exibirTelaLogin() {
        $this->template->menu = '';
        $this->template->body = new View('telaLogin');
        $this->template->body->formAction = 'home/logar';
    }

    protected function destacarPesquisarIndividuo() {
        $this->template->menu->arrClassPesIndividuo = array('class' => 'ui-btn-active ui-state-persist');
    }

    protected function destacarCadastrarIndividuo() {
        $this->template->menu->arrClassCadIndividuo = array('class' => 'ui-btn-active ui-state-persist');
    }

    protected function destacarPesquisarVacina() {
        $this->template->menu->arrClassPesVacina = array('class' => 'ui-btn-active ui-state-persist');
    }
    
    protected function destacarCadastrarVacina() {
        $this->template->menu->arrClassCadVacina = array('class' => 'ui-btn-active ui-state-persist');
    }

}
